package com.ssm.lzh.controller;

import com.github.pagehelper.PageInfo;
import com.ssm.hj.page.Page;
import com.ssm.hj.search.MemberSearch;
import com.ssm.lzh.service.ExerciseService;
import com.ssm.pojo.exercise;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sun.misc.Contended;

import javax.annotation.Resource;

@Controller
@RequestMapping("/lzh")
public class ExerciseController {

    @Resource
    private ExerciseService exerciseService;

    @RequestMapping("/queryAllExercise")
    @ResponseBody
    public PageInfo<exercise> queryAllExercise(@RequestBody Page<exercise> page){
        return this.exerciseService.queryAllExercise(page);
    }

    @RequestMapping("/addExercise")
    @ResponseBody
    public int addExercise(@RequestBody exercise exercise){
        return this.exerciseService.addExercise(exercise);
    }

    @RequestMapping("/UpdateExercise")
    @ResponseBody
    public int updateExercise(@RequestBody exercise exercise){
        return this.exerciseService.updateExercise(exercise);
    }

    @RequestMapping("/deleteExercise")
    @ResponseBody
    public int deleteExercise(String id){
        return this.exerciseService.deleteExercise(id);
    }
}
